package com.cv.audit.dal.mapper.report;

import com.cv.audit.controller.audit.report.vo.AuditReportLogPageReqVO;
import com.cv.audit.controller.audit.report.vo.AuditReportLogRespVO;
import com.cv.audit.dal.dataobject.report.AuditReportLogDO;
import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.mybatis.core.mapper.BaseMapperX;
import com.cv.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.cv.framework.security.core.utils.SecurityFrameworkUtil;
import org.apache.ibatis.annotations.Mapper;

/**
 * 举报处理日志数据层
 *
 * @author Charles_XDXD
 */
@Mapper
public interface AuditReportLogMapper extends BaseMapperX<AuditReportLogDO> {

    default PageResult<AuditReportLogRespVO> getPage(AuditReportLogPageReqVO reqVO) {
        return selectJoinPage(reqVO, AuditReportLogRespVO.class, new MPJLambdaWrapperX<AuditReportLogDO>()
                .selectAll(AuditReportLogDO.class)
                .eqIfPresent(AuditReportLogDO::getUserId, SecurityFrameworkUtil.getLoginUserId())
                .betweenIfPresent(AuditReportLogDO::getCreateTime, reqVO.getRecordTime())
        );
    }

}
